package com.example.emos.api.business.controller;


import cn.dev33.satoken.annotation.SaCheckLogin;
import com.example.emos.api.business.controller.form.FileForm;
import com.example.emos.api.business.controller.form.SearchLeaveByPageForm;
import com.example.emos.api.business.service.FileService;
import com.example.emos.api.common.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;

@RestController
@RequestMapping("/file")
@Tag(name = "FileController", description = "文件管理")
@Slf4j
public class FileController {

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    @Operation(summary = "上传文件")
    @SaCheckLogin
    public R searchLeaveByPage(MultipartFile file, String fileName, String fileMD5, Integer chunkIndex,
                               Integer chunks) {
        return fileService.uploadFile(file, fileName, fileMD5, chunkIndex,chunks);
    }
}
